Skip to content

test: Improve validation coverage#8

Merged
tymondesigns merged 1 commit into
mainfrom
tests/improve-coverage
Jun 24, 2026
Merged

test: Improve validation coverage#8
tymondesigns merged 1 commit into
mainfrom
tests/improve-coverage

Conversation

@tymondesigns

Copy link
Copy Markdown
Contributor

This pull request introduces a comprehensive suite of validation tests for OpenAPI documents and enhances the test infrastructure to support custom Pest expectations for OpenAPI meta-schema validation. The changes improve test coverage for a wide range of OpenAPI validation scenarios and make it easier to write expressive tests for schema validation errors.

Test Infrastructure Improvements:

  • Added tests/Expectations.php with custom Pest expectations (toPassOpenApiValidation, toFailOpenApiValidation, etc.) for OpenAPI meta-schema validation, and configured autoloading for this file in composer.json. This allows for more expressive and reusable validation assertions in test cases. [1] [2]
  • Added a PHPStan stub file for custom Pest expectations and configured it in phpstan.dist.neon to improve static analysis and IDE support for the new expectations.

Validation Test Coverage:

  • Added new unit tests covering OpenAPI document validation, including minimal valid documents, documents with missing required fields, and edge cases for components, paths, parameters, responses, examples, licenses, security schemes, and request bodies. [1] [2] [3] [4] [5] [6] [7] [8] [9]
  • Added tests for the ValidationException to ensure error messages and structured error arrays are correctly returned when validation fails.

Other:

  • Removed the code coverage report configuration from phpunit.dist.xml, likely to streamline test runs or because coverage is handled elsewhere.

@tymondesigns tymondesigns marked this pull request as ready for review June 24, 2026 07:13
@tymondesigns tymondesigns merged commit a1126dc into main Jun 24, 2026
17 checks passed
@tymondesigns tymondesigns deleted the tests/improve-coverage branch June 24, 2026 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant